#include <stdio.h>

struct pcard {
    unsigned pips : 4;
    unsigned suit : 2;
    char a[10];
};

struct _abc {
    int a : 1, b : 16, c : 16;
} ;

struct _small_integers {
    int i1 : 7, i2 : 7, i3 : 7,
        : 11, /* implicit bit field */
        i4 : 7, i5 : 7, i6 : 7;
};

struct _def {
    unsigned d : 1, : 0, e : 1, : 0, f : 1;
};

union _xyz {
    struct _bits {
        unsigned x : 3;
        unsigned y : 2;
        unsigned z : 3;
    } bits;
    unsigned bundle;
};

    
int main(int argc, char *argv[])
{
    struct pcard card;
    union _xyz  xyz; 
    card.pips = 0xA;
    card.suit = 0x5;
    card.a[0] = 'h';
    card.a[9] = 'c';
    char c = 'b';

    extern void print_bit(int);

    print_bit(0xa3b42233);

    printf ("sizeof(char)=%d\n", sizeof('A'));
    printf ("sizeof(char)=%d\n", sizeof(c));
    
    /* sizeof(struct pcard) = 12 */
    printf("sizeof(struct pcard)=%ld\n", sizeof(struct pcard));

    /* sizeof(struct _abc) = 8 */
    printf("sizeof(struct _abc)=%ld\n", sizeof(struct _abc));
    
    /* sizeof(struct _small_integers) = 8 */
    printf("sizeof(struct _small_integers)=%ld\n", sizeof(struct _small_integers));

    /* sizeof(struct _def) = 8 */
    printf("sizeof(struct def)=%ld\n", sizeof(struct _def));

    xyz.bits.x = 3;
    xyz.bits.y = 2;
    xyz.bits.z = 4;

    printf("bundle=0x%x\n", xyz.bundle);
    print_bit(xyz.bundle);
    
    return 0;
}

    
